package leihua.crm.commons.utils;

import org.apache.poi.hssf.usermodel.HSSFCell;

/**
 * @Author leiHua
 * @Date 2022/10/14 13:42
 */
public class HSSFUtils {
    public static String getCellValueForString(HSSFCell cell){
        String str="";
        if (cell.getCellType() == HSSFCell.CELL_TYPE_BOOLEAN) {  //如果类型是boolean
            str+=cell.getBooleanCellValue()+" ";
        } else if (cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA) { //如果是公式类型
            str+=cell.getCellFormula()+" ";
        } else if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {  //如果是字符串类型的
           str+=cell.getStringCellValue()+" ";
        } else if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {  //数字类型
            str+=cell.getNumericCellValue()+" ";
        } else {  //若是空 或者错误类型
            System.out.print("" +" ");
        }
        return str;
    }
}
